Repository navigation
Freeze the install-ID file loader's behaviour in fixtures - #42
Merged
Merged
Conversation
Add tests/install-id-fixtures: the shared trace-client install-ID corpus (stored as binary via .gitattributes) and expected.txt, recording what InstallIdFromFile at release 0.4.0 does with each file. InstallIdFixturesTest replays every line against the loader, and VersionConsistencyTest checks that every written version agrees with TraceClient.csproj. The README notes that released fixtures are frozen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
tests/install-id-fixtures/: the shared trace-client install-ID corpus (20*.idfiles) andexpected.txt, which records whatTraceClient.InstallIdFromFiledoes with each file. A.gitattributesline (tests/install-id-fixtures/** binary) keeps CRLF, BOM and non-UTF-8 bytes exactly as written.InstallIdFixturesTest: for everyexpected.txtline, the fixture is copied into a fresh temp directory and the loader is called there.loadedmeans the returned ID matches and the file is byte-identical.replacedmeans a lowercase uuid4 is returned and the file now holds exactly that ID plus\n.keptmeans the file is byte-identical and the returned uuid4 does not appear in it. The test also fails if the*.idfiles in the directory differ from the setexpected.txtnames.VersionConsistencyTest: checks thatTraceClient.csproj's<Version>matches theTraceClient.csheader (trace-client X --),const string Version = "X"and the README'strace-client/X (, and that each appears exactly once.SourceTreehelper: finds the repository root from the test assembly by walking up toTraceClient.sln, so the fixtures are read from the source tree on Linux, Windows and .NET Framework alike.expected.txtline.The client source and version are unchanged.
Why
The fleet's release automation will soon check install IDs before every release. It requires each released fixture to stay byte-identical, each released
loaded/keptline inexpected.txtto stay unchanged, and CI (which runs this test) to be green on the tagged commit. An ID that a previous release stored must keep loading as the same ID, and a file the loader cannot read must never be overwritten.Measured classification
Each line was found by running a throwaway harness outside the repository. The harness called
InstallIdFromFileon a copy of each fixture, once against the0.4.0tag and once againstmain. Both runs gave identical results:third.is-valid), comment-first (real-id), bom (bom-id), id-then-not-utf8 (good-id)Differences from trace-client-python:
bom.idis loaded asbom-id, where Python replaces it.File.ReadAllLinesstrips the UTF-8 byte order mark.not-utf8.idis replaced, where Python keeps it. Its leadingFF FEis taken as a UTF-16LE byte order mark, the bytes decode without error, and no line is a valid ID.id-then-not-utf8.idis loaded asgood-id, where Python keeps it. .NET substitutes U+FFFD for invalid bytes rather than failing, and the first line is already a valid ID.Because of this, no fixture in the corpus is
keptfor this client. Unreadable paths (for example, a directory where the file should be) are still left alone, as the existingInstallIdTestcovers.Testing
dotnet test -c Release -p:IncludeNetFramework=falseon .NET 8 SDK 8.0.424 (Linux): 189 passed. The new tests account for 23 of them.expected.txtoutcome was changed and a strayextra.idwas added. Both new fixture tests failed as intended, and the files were then restored.git show HEAD:tests/install-id-fixtures/crlf.id | xxdshows0d0a, andbom.idstarts withefbbbf.drafted by Claude on behalf of Daniel Stephenson
🤖 Generated with Claude Code